home *** CD-ROM | disk | FTP | other *** search
Wrap
; NSIS Script For ClamAV ; Installer v4.24p1 by Brian Bruns ; Uses installer DLLs from: ; ; cpudesc.dll ; Peter Mason, CSIRO DEM MMTG. peter.mason@csiro.au ; NSIS plug-in for getting a bit of CPU information. ; Version 1.2, July 2003. !include "Sections.nsh" !include "LogicLib.nsh" ;Title Of Your Application Name "ClamAV For Windows 0.88.2-1/20060516 - Cgw1.5.20snap Build" ;Do A CRC Check CRCCheck On ;Output File Name OutFile "installers\clamav-0.88.2-1.exe" ;License Page Introduction LicenseText "You must agree to this license before installing." ;License Data LicenseData "C:\clamav-devel\Copying.txt" ;The Default Installation Directory InstallDir "C:\clamav-devel" ;The text to prompt the user to enter a directory DirText "Please select the folder below you wish to install to. Do not change it unless you absolutely need to, as certain parts of ClamAV are hardwired to the C:\clamav-devel directory." ShowInstDetails show SetCompress Auto SetCompressor lzma SetOverwrite IfNewer SetDatablockOptimize on Page license Page components Page directory Page instfiles UninstPage uninstConfirm UninstPage instfiles InstType "Standard" InstType "Full" InstType "Minimal" ;LicenseForceSelection checkbox "I have read the license and agree." Section "ClamAV Base (required)" SectionIn 1 2 3 RO ${If} ${FileExists} "$INSTDIR\bin\clamd.exe" ExecWait '"$INSTDIR\bin\killall.exe" clamd.exe' ExecWait '"$INSTDIR\bin\killall.exe" freshclam.exe' ExecWait '"$INSTDIR\bin\killall.exe" clamdscan.exe' ExecWait '"$INSTDIR\bin\killall.exe" clamscan.exe' Delete "$INSTDIR\clamd.sock" MessageBox MB_OK|MB_ICONEXCLAMATION "An existing install of ClamAV For Windows was detected, and all running processes were killed to ensure a clean upgrade. Please do not forget to restart the clamd or freshclam daemon if you use them." ${EndIf} SetOutPath $INSTDIR\bin File /r "C:\clamav-devel\bin\clam*.exe" File /r "C:\clamav-devel\bin\freshclam.exe" File /r "C:\clamav-devel\bin\sigtool.exe" ;File /r "C:\clamav-devel\bin\cygclamav-1.dll" SetOutPath $INSTDIR File /r "C:\clamav-devel\man" File /r "C:\clamav-devel\share" File /r "C:\clamav-devel\sosdg" SetOverwrite off File /r "C:\clamav-devel\etc" SetOverwrite IfNewer File /r "C:\clamav-devel\AUTHORS" File /r "C:\clamav-devel\BUGS" File /r "C:\clamav-devel\ChangeLog" File /r "C:\clamav-devel\FAQ" File /r "C:\clamav-devel\INSTALL" File /r "C:\clamav-devel\NEWS" File /r "C:\clamav-devel\README" File /r "C:\clamav-devel\TODO" File /r "C:\clamav-devel\*.txt" File /r "C:\clamav-devel\*.bat" File /r "C:\clamav-devel\clamav-qs1.pdf" CreateDirectory $INSTDIR\log CreateDirectory $INSTDIR\tmp ; Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ClamAV" "DisplayName" "ClamAV (remove only)" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ClamAV" "UninstallString" "$INSTDIR\uninstall.exe" SetOutPath $INSTDIR WriteUninstaller "uninstall.exe" SetOutPath $INSTDIR\sosdg File /r "C:\installer scripts\clamav-devel.nsi" SectionEnd Section "Cygwin Support Files (Required)" SectionIn 1 2 3 RO SetOutPath $INSTDIR\bin File /r "C:\clamav-devel\bin\cygwin1.dll" File /r "C:\clamav-devel\bin\cygbz2-1.dll" File /r "C:\clamav-devel\bin\cygz.dll" File /r "C:\clamav-devel\bin\cyggmp-3.dll" File /r "C:\clamav-devel\bin\cygminires.dll" File /r "C:\clamav-devel\bin\mount.exe" File /r "C:\clamav-devel\bin\umount.exe" File /r "C:\clamav-devel\bin\killall.exe" File /r "C:\clamav-devel\bin\unzip.exe" ; Determine CPU type for which GMP to install ; Produces output similar to: ; INTELP=d AMD=add PPRO=b MMX=d SSE=b SSE2=b 3DNOW=d ARCH=dd LEVEL=dd NCPU=dd MHZ=ddddd RAM=dddd cpudesc::tell Pop $0 StrCpy $1 $0 1, 28 IntFmt $2 "%u" $1 ; If no MMX support, install the i386 DLL which actually works on older processors ${If} $2 = 0 MessageBox MB_OK|MB_ICONEXCLAMATION "We've detected that you are using a non-MMX enabled processor. Switching support DLL files to i386 compatibility versions." File /r "C:\clamav-devel\bin\cyggmp-i386-3.dll" Delete /REBOOTOK $INSTDIR\bin\cyggmp-3.dll Rename /REBOOTOK $INSTDIR\bin\cyggmp-i386-3.dll $INSTDIR\bin\cyggmp-3.dll ${EndIf} SectionEnd Section "Force GMP For 386/486/pentium with no mmx" ;SectionIn SetOutPath $INSTDIR\bin File /r "C:\clamav-devel\bin\cyggmp-i386-3.dll" Delete /REBOOTOK $INSTDIR\bin\cyggmp-3.dll Rename /REBOOTOK $INSTDIR\bin\cyggmp-i386-3.dll $INSTDIR\bin\cyggmp-3.dll SectionEnd Section "Start Menu Shortcuts" SectionIn 1 2 ;Add Shortcuts SetOutPath $INSTDIR CreateDirectory "$SMPROGRAMS\ClamAV" CreateShortCut "$SMPROGRAMS\ClamAV\Start Clamd.lnk" "$INSTDIR\start-clamd.bat" "" "$INSTDIR\start-clamd.bat" 0 CreateShortCut "$SMPROGRAMS\ClamAV\Stop Clamd.lnk" "$INSTDIR\stop-clamd.bat" "" "$INSTDIR\stop-clamd.bat" 0 CreateShortCut "$SMPROGRAMS\ClamAV\Freshclam (virus updates).lnk" "$INSTDIR\bin\freshclam.exe" "" "$INSTDIR\bin\freshclam.exe" 0 CreateShortCut "$SMPROGRAMS\ClamAV\Readme (Windows Version).lnk" "$INSTDIR\readme-win32.txt" "" "$INSTDIR\readme-win32.txt" 0 CreateShortCut "$SMPROGRAMS\ClamAV\Readme (Author Version).lnk" "$INSTDIR\readme" "" "$INSTDIR\readme" 0 CreateShortCut "$SMPROGRAMS\ClamAV\License.lnk" "$INSTDIR\copying.txt" "" "$INSTDIR\copying.txt" 0 CreateShortCut "$SMPROGRAMS\ClamAV\ClamAV Quickstart.lnk" "$INSTDIR\clamav-qs1.pdf" "" "$INSTDIR\clamav-qs1.pdf" 0 CreateShortCut "$SMPROGRAMS\ClamAV\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 SectionEnd Section "Cygwin Registry Values (Recommended)" SectionIn 1 2 3 CreateDirectory C:\cygwin\tmp ${If} ${FileExists} "C:\cygwin\bin\cygwin1.dll" ; We know cygwin is apparently already installed... MessageBox MB_OK|MB_ICONEXCLAMATION "Warning: Existing Cygwin installation found. Please make sure you only have one version of the cygwin1.dll on your system or you WILL have problems!" ${Else} CreateDirectory C:\cygwin\tmp ExecWait '"$SYSDIR\CACLS.EXE" C:\cygwin\tmp /E /P Everyone:F' ExecWait '"$INSTDIR\bin\mount.exe" -b C:\cygwin /' WriteRegStr HKLM "SOFTWARE\Cygnus Solutions\Cygwin\mounts v2" "cygdrive prefix" "/cygdrive" WriteRegDWORD HKLM "SOFTWARE\Cygnus Solutions\Cygwin\mounts v2" "cygdrive flags" 0x00000022 ${EndIf} ;ExecWait '"$SYSDIR\CACLS.EXE" $INSTDIR\log /E /P Everyone:F' ;ExecWait '"$SYSDIR\CACLS.EXE" $INSTDIR\tmp /E /P Everyone:F' SectionEnd ; Obsoleted - dont use ;Var WinType ;Section "TMPDIR And Permissions (Recommended)" ; Call GetWindowsVersion ; Pop $R0 ; ${If} $R0 == "95" ; StrCpy "$WinType" "9x" ; ${ElseIf} $R0 == "98" ; StrCpy "$WinType" "9x" ; ${ElseIf} $R0 == "ME" ; StrCpy "$WinType" "9x" ; ${ElseIf} $R0 == "NT 4.0" ; StrCpy "$WinType" "NT" ; ${ElseIf} $R0 == "2000" ; StrCpy "$WinType" "NT" ; ${ElseIf} $R0 == "XP" ; StrCpy "$WinType" "NT" ; ${ElseIf} $R0 == "2003" ; StrCpy "$WinType" "NT" ; ${Else} ; StrCpy "$WinType" "Unknown" ; ${Endif} ; ; CreateDirectory C:\cygwin\tmp ; ; ${If} $WinType == "NT" ; ExecWait '"$SYSDIR\CACLS.EXE" C:\cygwin\tmp /E /P Everyone:F' ; ExecWait '"$SYSDIR\CACLS.EXE" $INSTDIR\log /E /P Everyone:F' ; ExecWait '"$SYSDIR\CACLS.EXE" $INSTDIR\tmp /E /P Everyone:F' ; ; ${Endif} ;SectionEnd Section "Tar File Support (Recommended)" SectionIn 1 2 3 SetOutPath $INSTDIR\bin File /r "C:\clamav-devel\bin\tar.exe" File /r "C:\clamav-devel\bin\cygiconv-2.dll" File /r "C:\clamav-devel\bin\cygintl-2.dll" SectionEnd Section "Contributed Tools" SectionIn 2 SetOutPath $INSTDIR File /r "C:\clamav-devel\contrib" File /r "C:\clamav-devel\examples" File /r "C:\clamav-devel\thirdparty" CreateDirectory "$SMPROGRAMS\ClamAV\Tools" CreateShortCut "$SMPROGRAMS\ClamAV\Tools\Setup Clamd Service.lnk" "$INSTDIR\thirdparty\runclamd" "" "$INSTDIR\thirdparty\runclamd" 0 CreateShortCut "$SMPROGRAMS\ClamAV\Tools\Clamscan Wrapper.lnk" "$INSTDIR\thirdparty\runclamscan" "" "$INSTDIR\thirdparty\runclamscan" 0 CreateShortCut "$SMPROGRAMS\ClamAV\Tools\About Third Party Tools.lnk" "$INSTDIR\thirdparty\readme.txt" "" "$INSTDIR\thirdparty\readme.txt" 0 SectionEnd Section "ClamAV Virus Test Files" SectionIn 1 2 SetOutPath $INSTDIR File /r "C:\clamav-devel\test" SectionEnd Section "Documentation" SectionIn 1 2 SetOutPath $INSTDIR File /r "C:\clamav-devel\docs" CreateShortCut "$SMPROGRAMS\ClamAV\Documentation (HTML).lnk" "$INSTDIR\docs\html\clamdoc.html" "" "$INSTDIR\docs\html\clamdoc.html" 0 CreateShortCut "$SMPROGRAMS\ClamAV\Documentation (PDF).lnk" "$INSTDIR\docs\clamdoc.pdf" "" "$INSTDIR\docs\clamdoc.pdf" 0 SectionEnd Section "Development" SectionIn 2 SetOutPath $INSTDIR File /r "C:\clamav-devel\lib" File /r "C:\clamav-devel\include" SectionEnd Section "Update virus definitions when install is complete" SectionIn 1 2 3 ExecWait '$INSTDIR\bin\freshclam.exe' SectionEnd ;Section "ClamAV Source Code (GPL)" ; CreateDirectory $INSTDIR\src ; SetOutPath $INSTDIR\src ; NSISdl::download http://www.sosdg.org/clamav-win32/clamav-devel-latest.src.bz2 clamav-devel-latest.src.bz2 ; Pop $R0 ;Get the return value ; StrCmp $R0 "success" +3 ; MessageBox MB_OK "Download failed: $R0" ; Quit ;SectionEnd Section "Fix Permissions (recommended)" SectionIn 1 2 3 ExecWait 'echo y|"$SYSDIR\CACLS.EXE" $INSTDIR /T /P Administrator:F Everyone:F' SectionEnd UninstallText "This will uninstall ClamAV from your system" Section Uninstall ;Kill running procs ExecWait '"$INSTDIR\bin\killall.exe" clamd.exe' ExecWait '"$INSTDIR\bin\killall.exe" freshclam.exe' ExecWait '"$INSTDIR\bin\killall.exe" clamdscan.exe' ExecWait '"$INSTDIR\bin\killall.exe" clamscan.exe' ;Delete Files RMDir /r "$INSTDIR" ; Additional Files To Remove During Uninstall RMDir /r "$SMPROGRAMS\ClamAV" ;Delete Uninstaller And Unistall Registry Entries Delete "$INSTDIR\uninstall.exe" DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\ClamAV" DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ClamAV" RMDir "$INSTDIR" SectionEnd